package com.yylc.cscore.util;

/**
 * @author xiangnan
 * date 2018/5/2
 */
public class PageUtil {

    public static int getStart(int current, int size) {
        if (current < 1) {
            return 0;
        } else {
            return (current - 1) * size;
        }
    }

    public static boolean check(int current, int total, int size) {
        if (total == 0) {
            return true;
        }

        if (current <= 0) {
            return false;
        }

        if (total % size == 0) {
            return current <= total / size;
        } else {
            return current <= total / size + 1;
        }
    }

}
